package jgl.vajra.operator.part.mine.model;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import jgl.vajra.operator.bean.AlipayAccountBean;
import jgl.vajra.operator.bean.BindAccountBean;
import jgl.vajra.operator.manager.AccountManager;
import jgl.vajra.operator.part.mine.contract.WithdrawalPageContract;
import jgl.vajra.operator.widget.manager.RxJavaHttpManager;
import jgl.vajra.operator.widget.manager.retrofit.RetrofitJsonManager;
import jgl.vajra.operator.widget.utils.UIUtils;

public class WithdrawalPageModel extends WithdrawalPageContract.Model{
    @Override
    public Observable<List<BindAccountBean>> getBindAccountData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getBindAccountData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<String> getAlipayAuthData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getAlipayAuthData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<AlipayAccountBean> getAlipayAccountData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getAlipayAccountData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<String> bindBankCardData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().bindBankCardData(map, AccountManager.getInstance().getLoginData(UIUtils.getContext()).authorization)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<String> incomeWithdrawData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().incomeWithdrawData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }
}
